
/**
 * 下拉多选时, 实现全选和其他选项之间的互斥
 * @param val
 * @param oldVal
 * @param lineCodeList
 * @param lineList
 * @return {string[]}
 */
export function selectLineCode (val, oldVal, lineCodeList, lineList) {
  if (val.indexOf('all') !== -1 && oldVal.indexOf('all') !== -1 && val.length > 1) { // 如果操作前有全选且当前也选中了数量大于1 则移除掉全选
    lineCodeList.splice(val.indexOf('all'), 1)
  } else if (val.indexOf('all') !== -1 && oldVal.indexOf('all') === -1 && val.length > 1) { // 如果新的选择里有全选 则 只勾选全选这个选项
    lineCodeList = ['all']
  } else if (val.indexOf('all') === -1 && !oldVal.includes('all') && val.length === lineList.length && oldVal.length > 1) {
    lineCodeList = ['all']
  }
  return lineCodeList
}
